$OpenBSD: patch-gtk_makefile,v 1.12 2016/03/11 18:13:19 naddy Exp $

Drop `-pedantic'
/usr/local/include/gtk-3.0/gdk/gdktypes.h:318: error: comma at end of enumerator list

--- gtk/makefile.orig	Thu Nov 27 21:47:24 2014
+++ gtk/makefile	Fri Mar 11 18:05:48 2016
@@ -6,15 +6,8 @@
 # Builds for GTK+ 2 and no longer supports GTK+ 1.
 # Also works with ming32-make on Windows.
 
-.SUFFIXES: .cxx .c .o .h .a
-ifdef CLANG
-CXX = clang++ -Wno-deprecated-register
-CC = clang
-# Can choose aspect to sanitize: address and undefined can simply change SANITIZE but for
-# thread also need to create Position Independent Executable -> search online documentation
-SANITIZE = address
-#SANITIZE = undefined
-endif
+.SUFFIXES: .cxx .c .o .h .a .so
+AR = ar
 RANLIB = touch
 
 ifdef GTK3
@@ -36,17 +29,20 @@ DEL = del /q
 COMPLIB=..\bin\scintilla.a
 else
 DEL = rm -f
-COMPLIB=../bin/scintilla.a
+COMPLIB=../bin/libscintilla.a
+LEXERLIB=../bin/libscintilla_lexers.a
+SHAREDLIB=../bin/libscintilla.so.${LIBscintilla_VERSION}
+SHAREDLEXER=../bin/libscintilla_lexers.so.${LIBscintilla_lexers_VERSION}
 endif
 
 vpath %.h ../src ../include ../lexlib
 vpath %.cxx ../src ../lexlib ../lexers
 
-INCLUDEDIRS=-I ../include -I ../src -I ../lexlib
+INCLUDEDIRS=-I ../include -I ../src -I ../lexlib  -I${LOCALBASE}/include
 ifdef CHECK_DEPRECATED
 DEPRECATED=-DGDK_PIXBUF_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DDISABLE_GDK_FONT
 endif
-CXXBASEFLAGS=-Wall -pedantic -DGTK -DSCI_LEXER $(INCLUDEDIRS) $(DEPRECATED)
+CXXBASEFLAGS=-Wall -DGTK -DSCI_LEXER -Dunix $(INCLUDEDIRS) $(DEPRECATED)
 
 ifdef NOTHREADS
 THREADFLAGS=-DG_THREADS_IMPL_NONE
@@ -65,24 +61,35 @@ else
 CTFLAGS=-DDEBUG -g $(CXXBASEFLAGS) $(THREADFLAGS)
 endif
 else
-CTFLAGS=-DNDEBUG -Os $(CXXBASEFLAGS) $(THREADFLAGS)
+CTFLAGS+=-DNDEBUG $(CXXBASEFLAGS) $(THREADFLAGS)
 endif
 
 CFLAGS:=$(CTFLAGS)
-CXXTFLAGS:=--std=c++0x $(CTFLAGS) $(REFLAGS)
+CXXTFLAGS:=$(CTFLAGS) $(REFLAGS)
 
 CONFIGFLAGS:=$(shell pkg-config --cflags $(GTKVERSION))
 MARSHALLER=scintilla-marshal.o
 
 .cxx.o:
 	$(CXX) $(CONFIGFLAGS) $(CXXTFLAGS) $(CXXFLAGS) -c $<
+.cxx.so:
+	$(CXX) -fPIC $(CONFIGFLAGS) $(CXXTFLAGS) $(CXXFLAGS) -o $@ -c $<
 .c.o:
 	$(CC) $(CONFIGFLAGS) $(CFLAGS) -w -c $<
+.c.so:
+	$(CC) -fPIC $(CONFIGFLAGS) $(CFLAGS) -w -o $@ -c $<
+ 
 
 LEXOBJS:=$(addsuffix .o,$(basename $(notdir $(wildcard ../lexers/Lex*.cxx))))
 
-all: $(COMPLIB)
+all: $(COMPLIB) $(SHAREDLIB) $(LEXERLIB) $(SHAREDLEXER)
 
+install:
+	mkdir -p ${PREFIX}/include/scintilla
+	install -m 444 ../include/*.h ${PREFIX}/include/scintilla
+	install -m 444 ${COMPLIB} ${LEXERLIB} ${PREFIX}/lib
+	install -m 444 ${SHAREDLIB} ${SHAREDLEXER} ${PREFIX}/lib
+
 clean:
 	$(DEL) *.o $(COMPLIB) *.plist
 
@@ -92,15 +99,26 @@ analyze:
 deps:
 	$(CXX) -MM $(CONFIGFLAGS) $(CXXTFLAGS) *.cxx ../src/*.cxx ../lexlib/*.cxx ../lexers/*.cxx | sed -e 's/\/usr.* //' | grep [a-zA-Z] >deps.mak
 
-$(COMPLIB): Accessor.o CharacterSet.o LexerBase.o LexerModule.o LexerSimple.o StyleContext.o WordList.o \
+LIBOBJS = Accessor.o CharacterSet.o LexerBase.o LexerModule.o LexerSimple.o StyleContext.o WordList.o \
 	CharClassify.o Decoration.o Document.o PerLine.o Catalogue.o CallTip.o CaseConvert.o CaseFolder.o \
 	ScintillaBase.o ContractionState.o EditModel.o Editor.o EditView.o ExternalLexer.o MarginView.o \
 	PropSetSimple.o PlatGTK.o \
 	KeyMap.o LineMarker.o PositionCache.o ScintillaGTK.o CellBuffer.o CharacterCategory.o ViewStyle.o \
 	RESearch.o RunStyles.o Selection.o Style.o Indicator.o AutoComplete.o UniConversion.o XPM.o \
 	$(MARSHALLER) $(LEXOBJS)
+
+$(COMPLIB): $(LIBOBJS)
 	$(AR) rc $@ $^
 	$(RANLIB) $@
+
+$(LEXERLIB): $(LEXOBJS)
+	$(AR) rc $@ $^
+	$(RANLIB) $@
+
+$(SHAREDLIB): $(addsuffix .so,$(basename $(LIBOBJS)))
+	$(CXX) -shared -fPIC -o $@ -Wl,-soname,$(notdir $(SHAREDLIB)) $^
+$(SHAREDLEXER): $(addsuffix .so,$(basename $(LEXOBJS)))
+	$(CXX) -shared -fPIC -o $@ -Wl,-soname,$(notdir $(SHAREDLEXER)) $^
 
 # Automatically generate header dependencies with "make deps"
 include deps.mak
